package com.caht.controller.user;

import com.caht.DTO.CommentReplyCommentsDTO;
import com.caht.VO.CommentReplyCommentsVO;
import com.caht.entity.comment;
import com.caht.result.Result;
import com.caht.servier.Impl.commentServierImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

    @RestController
    @RequestMapping("/user/comment")
    @Slf4j
public class commentController {

        @Autowired
        private commentServierImpl commentServier;

    //查询点赞 列表
    @GetMapping("/{postsId}")
    public Result<List<CommentReplyCommentsVO>> GetCommentAll(@PathVariable("postsId") Long postsId){
        List<CommentReplyCommentsVO> commentReplyCommentsVOS = commentServier.queryAll(postsId);
        return Result.success(commentReplyCommentsVOS);
    }

        /**
         * 评论 and 回复评论
         * @param replyCommentsDTO
         */
    @PostMapping()
    public void addcomment(@RequestBody CommentReplyCommentsDTO replyCommentsDTO){
        log.info("回复数据:",replyCommentsDTO);
        commentServier.addCommentReplyComments(replyCommentsDTO);
    }
}
